from tortoise import models, fields


class User(models.Model):
    userid = fields.CharField(max_length=36, null=False, description="用户id", pk=True)
    groupid = fields.CharField(max_length=36, null=True, description="角色id")
    loginname = fields.CharField(max_length=36, null=False, description="登录名")
    pwd = fields.CharField(max_length=36, null=False, description="密码")
    realname = fields.CharField(max_length=36, null=False, description="真实姓名")
    mobilephone = fields.CharField(max_length=36, null=False, description="手机号码")
    sex = fields.CharField(max_length=36, null=False, description="性别")
    status = fields.CharField(max_length=36, null=False, description="状态")

    def getJson(self):
        return {
            'userid': self.userid,
            'groupid': self.groupid,
            'loginname': self.loginname,
            'pwd': self.pwd,
            'realname': self.realname,
            'mobilephone': self.mobilephone,
            'sex': self.sex,
            'status': self.status,
        }
